<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>index</title>
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no"
    />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <link rel="stylesheet" href="../../css/mui.min.css" />
    <style>
      html,
      body {
        background-color: #efeff4;
      }

      .home_icon {
        width: 24px;
      }

      .mui-bar-tab .mui-tab-item.mui-active {
        color: #004a86;
      }

      .mui-bar-tab {
        height: 53px;
        padding-top: 3px;
      }

      .mui-bar.mui-bar-nav {
        background-color: #034880;
        color: #fff;
        border: none;
        box-shadow: none;
      }

      .mui-card-header {
        background-color: #034880;
        color: #fff;
        padding-top: 0;
        padding-left: 0;
      }

      .mui-card-footer:before,
      .mui-card-header:after {
        background: none;
      }

      .home_info {
        list-style: none;
        padding: 0;
        margin: 0;
      }

      .home_info li {
        float: left;
        /* width: 600px; */
      }

      .mui-scroll .mui-card {
        margin: 0;
        /* background-color: #fff; */
        border-radius: 20px;
        position: absolute;
        top: 80px;
        height: 100vh;
        width: 100vw;
      }

      .mui-card-content {
        padding: 50px 20px;
      }

      .mui-row {
        margin-top: 30px;
      }

      .list_icon a {
        display: flex;
        background-color: #ffffff;
        box-shadow: 0px 0px 24px 0px rgba(131, 144, 155, 0.39);
        border-radius: 10px;
        color: #333333;
      }

      .txts {
        margin: auto 0;
      }

      .list_icon .imgs {
        width: 80px;
        height: 80px;
      }

      .list_icon .imgs1 {
        background: url(./img/home/shouye_jishujiaodiqueren.png) no-repeat;
        background-size: 100%;
      }

      .list_icon .imgs2 {
        background: url(./img/home/shouye_renyuanbiangeng.png) no-repeat;
        background-size: 100%;
      }

      .list_icon .imgs3 {
        background: url(./img/home/shouye_zhixingdaiban.png) no-repeat;
        background-size: 100%;
      }

      .list_icon .imgs4 {
        background: url(./img/home/shouye_renwudaiqueren.png) no-repeat;
        background-size: 100%;
      }

      .list_icon .imgs5 {
        background: url(./img/home/shouye_yanshou.png) no-repeat;
        background-size: 100%;
      }

      .list_icon .imgs6 {
        background: url(./img/home/shouye_zhixingdaiban.png) no-repeat;
        background-size: 100%;
      }

      .list_icon .imgs7 {
        background: url(./img/home/shouye_zhixingdaiban.png) no-repeat;
        background-size: 100%;
      }

      .list_icon .imgs8 {
        background: url(./img/home/shouye_zhixingdaiban.png) no-repeat;
        background-size: 100%;
      }

      .list_icon .titles {
        margin: auto 0;
      }

      .lists {
        margin-bottom: 16px;
      }

      .lefts {
        margin-right: 9px;
      }

      .rights {
        margin-left: 9px;
      }

      .icons {
        display: inline-block;
        width: 80px;
        height: 80px;
        background: url(./img/home/shouye_jishujiaodiqueren.png) no-repeat;
        background-size: 100%;
      }
      .notice-wrap {
        position: relative;
      }
      .mui-badge {
        position: absolute;
        right: -12px;
        top: -4px;
      }
    </style>
  </head>

  <body>
    <div class="mui-inner-wrap">
      <header class="mui-bar mui-bar-nav">
        <div class="mui-card-header" style="border: none">
          <a
            class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"
          ></a>
          <div>
            <span class="notice-wrap mui-pull-right" id="notice">
              <img src="./img/home/tongzhi.png" style="width: 23px" />
              <span class="mui-badge mui-badge-danger" style="display: none"
                >0</span
              >
            </span>
            <img
              id="scan"
              src="./img/home/saoyisao.png"
              class="mui-pull-right"
              style="width: 23px; margin-right: 10px"
            />
          </div>
        </div>
      </header>
      <div class="mui-content mui-scroll-wrapper">
        <div class="mui-scroll">
          <div class="mui-card-header">
            <span class="mui-icon mui-icon icons"></span>
            <ul class="home_info mui-col-xs-8 mui-col-sm-8">
              <li style="margin-right: 5px">
                姓名：<span class="realName"></span>
              </li>
              <li>工号：<span class="userName"></span></li>
            </ul>
          </div>
          <div class="mui-card" id="menu">
            <!--内容区-->
            <div class="mui-card-content">
              <h3>任务待办</h3>
              <div class="mui-row">
                <div class="mui-col-sm-6 mui-col-xs-6 lists">
                  <div class="list_icon lefts">
                    <a href="./disclose/list.html">
                      <span class="mui-icon imgs imgs1"></span>
                      <span class="mui-media-body titles">技术交底确认</span>
                    </a>
                  </div>
                </div>
                <div class="mui-col-sm-6 mui-col-xs-6 lists">
                  <div class="list_icon rights">
                    <a href="./personChange/list.html">
                      <span class="mui-icon imgs imgs2"></span>
                      <span class="mui-media-body titles">人员变更</span>
                    </a>
                  </div>
                </div>
                <div class="mui-col-sm-6 mui-col-xs-6 lists">
                  <div class="list_icon lefts">
                    <a href="./performTasks/taskConfirm.html">
                      <span class="mui-icon imgs imgs4"></span>
                      <span class="mui-media-body titles">任务待确认</span>
                    </a>
                  </div>
                </div>
                <div class="mui-col-sm-6 mui-col-xs-6 lists">
                  <div class="list_icon rights">
                    <a href="./performTasks/carryoutToDo.html">
                      <span class="mui-icon imgs imgs3"></span>
                      <span class="mui-media-body titles">执行待办</span>
                    </a>
                  </div>
                </div>
                <div class="mui-col-sm-6 mui-col-xs-6 lists">
                  <div class="list_icon lefts">
                    <a href="./performTasks/taskList.html">
                      <span class="mui-icon imgs imgs5"></span>
                      <div class="txts">
                        <span class="mui-media-body titles">验收</span>
                        <p class="mui-media-body titles">工作组成员</p>
                      </div>
                    </a>
                  </div>
                </div>
                <!-- <div class="mui-col-sm-6 mui-col-xs-6 lists">
                  <div class="list_icon rights">
                    <a href="./accept/index.html">
                      <span class="mui-icon imgs imgs6"></span>
                      <div class="txts">
                        <span class="mui-media-body titles">验收</span>
                        <p class="mui-media-body titles">分公司场站</p>
                      </div>
                    </a>
                  </div>
                </div>
                <div class="mui-col-sm-6 mui-col-xs-6 lists">
                  <div class="list_icon lefts">
                    <a href="./knowledge/home.html">
                      <span class="mui-icon imgs imgs7"></span>
                      <span class="mui-media-body titles">知识库</span>
                    </a>
                  </div>
                </div>
                <div class="mui-col-sm-6 mui-col-xs-6 lists">
                  <div class="list_icon rights">
                    <a href="./setUp/setting.html">
                      <span class="mui-icon imgs imgs8"></span>
                      <span class="mui-media-body titles">设置</span>
                    </a>
                  </div>
                </div> -->
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <script src="../../js/mui.min.js"></script>
    <script src="./js/mkeyplus.base.js"></script>
    <script type="text/javascript" src="../../js/jquery-3.2.1.min.js"></script>
    <script
      src="./js/sqlite.js"
      type="text/javascript"
      charset="utf-8"
    ></script>
    <script type="text/javascript" charset="utf-8">
      //mui初始化
      mui.init()
      let network
      if (window.plus) {
        plusready()
      } else {
        document.addEventListener("plusready", plusready, false)
      }
      $(document).ready(function () {
        let user = JSON.parse(localStorage.getItem("mqmsUser"))
        console.log(user)
        $(".realName").text(user.realName)
        $(".userName").text(user.userName)
      })
      async function plusready() {
        //打开数据库
        await mui.DB.openSqlite()
        //获取字典
        let dictArr = [
          "valueUnit", //单位
          "wpTag", //标签
          "Format", //业态
          "valueType", //输入值类型
          "inputSymbol", //输入值符号
        ]
        let dictObj = {
          dictName: "",
          dictId: "",
          id: "",
          label: "",
          value: "",
          code: "",
        }
        // 创建字典数据表
        mui.DB.createFormat("dict", dictObj, "id")
        dictArr.forEach((dictName) => {
          mui.baseApp
            .httpRequst("post", "/app/sys/dictItem/getDictDetail", {
              dictName: dictName,
            })
            .then((res) => {
              console.log("字典")
              console.log(res)
              if (res.code == 0) {
                // 请求完成先删除旧数据
                mui.DB.deleteTableData("dict", "dictName", dictName)
                //重新组一下  只要需要的字段
                res.data.forEach((item) => {
                  let obj = {
                    dictName,
                  }
                  for (let key in dictObj) {
                    if (key != "dictName") {
                      obj[key] = item[key]
                    }
                  }
                  mui.DB.insertOrReplace("dict", obj)
                })
                let dictData = mui.DB.selectTableData("dict", [
                  { key: "dictName", value: dictName },
                ]).then((res) => {
                  console.log("存入数据" + dictName, res)
                })
              }
            })
        })
      }

      getNoticUnread()
      function getNoticUnread() {
        mui.baseApp.httpRequst(
          "get",
          "/app/api/notice/unread",
          { system: "APP" },
          function (res) {
            console.log(res)
            if (res.unreadNum) {
              $("#notice .mui-badge").text(res.unreadNum).show()
            } else {
              $("#notice .mui-badge").text(res.unreadNum).hide()
            }
          }
        )
      }

      $("#notice").on("click", function () {
        mui.baseApp.openWindow("./notices/notice.html")
      })
      $("#menu").on("click", "a", function (e) {
        e.preventDefault()
        let href = $(this).attr("href")
        mui.baseApp.openWindow(href)
      })
      $("#scan").on("click", function () {
        mui.baseApp.openWindow("./common/coder.html")
        //       mui.baseApp.openWindow('./upLoadFile/index.html')
      })
      window.addEventListener("back", function (event) {
        getNoticUnread()
      })
    </script>
  </body>
</html>
